package com.dengqi.mymodule.activity.arouter;

import android.os.Bundle;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.dengqi.mymodule.BaseActivity;
import com.dengqi.mymodule.R;
import com.dengqi.mymodule.entity.User;

// 在支持路由的页面上添加注解(必选)
// 这里的路径需要注意的是至少需要有两级，/xx/xx
@Route(path = Constant.path_act1)
public class Act1 extends BaseActivity {

    private TextView textView;
    /**
     * 坑：不能写private
     */
    @Autowired()
    String name;
    @Autowired(name = "age")
    int nianling;
    @Autowired
    User user;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_arouter_act);

        ARouter.getInstance().inject(this);
        textView = findViewById(R.id.text);
        String params = String.format("%s-%s\n%s", name, nianling, user!=null?user.toString():"null");
        textView.setText(params);
    }
}
